import { createRouter,createWebHistory,RouteRecordRaw} from "vue-router";

//创建对象类型的数组，用于保存路由地址和对应的匹配的vue组件
const routes:Array<RouteRecordRaw>=[
    {
        path:"/",
        name:"HelloWorld",
        component:()=>import('../components/HelloWorld.vue')
    },
    {
        path:"/Demo",
        name:"Demo",
        component:()=>import('../components/Demo.vue')
    },
    {
        path:"/Login",
        name:"Login",
        component:()=>import('../components/Login.vue')
    },
    {
        path:"/EditDemo/:Sid",
        name:"EditDemo",
        component:()=>import('../components/EditDemo.vue')
    },
]

//创建路由实例 createRouter():用于创建路由实例
//createWebHistory():用于创建一个使用HTML5 history API 的路由实例,允许您不在重新加载页面的前提下完成数据获取
//RouteRecordRaw():是Vue-Router 中用于定义路由ts类型
const router=createRouter({
    history:createWebHistory(),
    routes,
})

//导出路由
export default router